<?php
require_once('Zend/Controller/Front.php');

/**
 * The core resource class only has one method: "locate" which acts as an abstraction
 * to allow easy access to application-level resources such as the database, recaptcha,
 * service layers or more.
 * 
 * @author Michael Krotscheck
 */
class Core_Resource
{
	static function locate( $resourceId ) 
	{
		try
		{
			$frontController = Zend_Controller_Front::getInstance();
			$bootstrap = $frontController->getParam('bootstrap');
			if ( $bootstrap->hasResource ( $resourceId ))
			{
				return $bootstrap->getResource($resourceId);
			}
			return null;
		}
		catch ( Exception $e)
		{
			return null;
		}
	}
}